package com.tpc.yaoxpt.job;

import com.tpc.yaoxpt.schedule.DisOrderRepairScheduleService;
import com.tpc.yaoxpt.schedule.DisOrderScheduleService;
import javafx.concurrent.ScheduledService;
import javafx.util.Duration;

import java.util.concurrent.Executors;

public class DisOrderRepairJob {
    ScheduledService<Void> disOrderRepairSchedule = null;
    public void execScheduledService(){
        DisOrderRepairScheduleService disOrderRepairScheduleService = new DisOrderRepairScheduleService();
        disOrderRepairScheduleService.setExecutor(Executors.newFixedThreadPool(1));
        disOrderRepairScheduleService.setDelay(Duration.millis(1000));
        disOrderRepairScheduleService.setPeriod(Duration.millis(60000));
        disOrderRepairScheduleService.start();
        disOrderRepairSchedule = disOrderRepairScheduleService;
    }

    public void stopScheduledService(){
        disOrderRepairSchedule.cancel();
    }
}
